/** @jsxImportSource @emotion/react */
import * as React from "react";
import {Text, useTheme,} from "customize-easy-ui-component";
import { ReportViewProps, } from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {注意事项IndPl,} from "../../industrial/rarelyVary";
import {useItemsMapPressure} from "../../common/pressure";
import {Projects默认} from "./Regular.O-1";
import {检验结论报告} from "./Conclusion";
import {目录页VS} from "../../movable/rarelyVary";
import {ReportFirstPageHeadNmaNmbm} from "../../contain/rarelyVary";
import {首页设概SteelTh} from "./rarelyVary";
import {PipelineCharacteristPla} from "../../gas/plastics/viewFeature";
import {ConclusionAppendixVw} from "../../gas/plastics/ConclusionAppendix";
import {检验结论GasC} from "../../gas/viewRes";
import {FitnessServiceTblVw, FitnessServiceVw} from "./FitnessService";
import {ExplanatoryVw} from "./Explanatory";

export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
  const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    const [rootMenu]=useRepMenuDirItems(Projects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
  return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
            <div css={{display: 'flex', flexDirection: 'column', justifyContent: 'space-between', "@media print": {height: '100vh', pageBreakInside: 'avoid',}}}>
                {ReportFirstPageHeadNmaNmbm({theme, rep})}
                <div>
                    <Text variant="h3" css={{
                        textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {fontSize: theme.fontSizes[6],}
                    }}>压力管道定期检验报告 <br/>
                    </Text>
                    <Text variant="h4" css={{
                        textAlign: 'center',
                    }}></Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h6" css={{textAlign: 'center',}}>（ FJB/DC 10602-0-2024 ）</Text>
                </div>
                <div>{首页设概SteelTh({theme, orc, rep})}</div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
            </div>

            {注意事项IndPl({
                rep,
                comply: '书为依据《压力管道定期检验规则——公用管道》（TSG D7004-2010 ）对在用公用管道进行合于使用评价的结论性报告'
            })}

            {目录页VS({theme, orc, rep})}
            {检验结论报告({theme, orc, rep})}
            {检验结论GasC({theme, orc, rep, bcap: '检验'})}
            <Text css={{fontSize: '0.7rem'}}>
                注：1、受检单位对本报告结论如有异议，请在收到报告书之日起15日内，向检验机构提出书面意见。
                2、此栏手续不全，报告结论无效。
            </Text>
            <ConclusionAppendixVw orc={orc} rep={rep} table='附页表' title={'公用管道全面检验结论报告附页'}/>

            {mapFxian.get('公用管道合于使用评价结论报告')?.do && <>
                <FitnessServiceVw orc={orc} rep={rep}/>
                {检验结论GasC({theme, orc, rep})}
                <FitnessServiceTblVw orc={orc} rep={rep}/>
            </>}
            {mapFxian.get('合于使用评价续页二')?.do &&
                <ExplanatoryVw orc={orc} rep={rep} title='公用管道合于使用评价结论报告续页（二）' desc='发现问题及处理意见'/>
            }
            {mapFxian.get('管道特性表')?.do && <PipelineCharacteristPla orc={orc} rep={rep} title='管道特性表'/>}

            {/*{mapFxian.get('管道单线图')?.do && <PipeLineDiagram orc={orc} rep={rep} title={'管道单线图'}/>}*/}
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
  );
}
